Datatypes and Subtyping
نویسندگان
چکیده
We study a calculus with both subtyping and datatype deenitions. Our primary goal is to understand the interaction of subtyping with mutually recursive types, which raises diiculties beyond those addressed in previous studies. A second aim is to clarify the relations between structural subtyping and the user-declared subtyping found in languages such as C++, Eiiel, and Java.
منابع مشابه
Subtyping and Inheritance for Categorical
We extend Hagino's categorical datatypes with subtyping and a limited form of inheritance. The view of objects as coalgebras provides the inspiration for subtyping and inheritance for coalgebraic (or coinductive) types. Exploiting the duality between coalgebras and algebras then yields notions of subtyping and inheritance for algebraic (or inductive) types.
متن کاملGADT meet Subtyping
While generalized abstract datatypes (GADT) are now considered well-understood, adding them to a language with a notion of subtyping comes with a few surprises. What does it mean for a GADT parameter to be covariant? The answer turns out to be quite subtle. It involves fine-grained properties of the subtyping relation that raise interesting design questions. We allow variance annotations in GAD...
متن کاملConstructor Subtyping
Constructor subtyping is a form of subtyping in which an induc tive type is viewed as a subtype of another inductive type if has more constructors than As suggested in its potential uses include proof assistants and functional programming languages In this paper we introduce and study the properties of a simply typed calculus with record types and datatypes and which supports record sub typing ...
متن کاملGADTs Meet Subtyping
While generalized algebraic datatypes (GADTs) are now considered well-understood, adding them to a language with a notion of subtyping comes with a few surprises. What does it mean for a GADT parameter to be covariant? The answer turns out to be quite subtle. It involves fine-grained properties of the subtyping relation that raise interesting design questions. We allow variance annotations in G...
متن کاملModular Visitor Components A Practical Solution to the Expression Families Problem
The expression families problem can be defined as the problem of achieving reusability and composability across the components involved in a family of related datatypes and corresponding operations over those datatypes. Like the traditional expression problem, adding new components (either variants or operations) should be possible while preserving modular and static type-safety. Moreover, diff...
متن کامل